package supporter;

import utils.MapShell;

/**
 * 分页查询封装
 * @author adinlead
 */
public class TableItem {
    public TableItem(MapShell args) {
        this.page = args.getInteger("page", 1);
        this.rows = args.getInteger("rows", 10);
        String sort = args.getString("sort", "createtime");
        String scInfo = args.valueEquation("desc", "true") ? " DESC" : " ASC";
        this.orderInfo = " ORDER BY " + sort + scInfo;
    }

    private int page;
    private int rows;
    private String orderInfo;

    public int page() {
        return page;
    }

    public int rows() {
        return rows;
    }

    public String orderBy() {
        return orderInfo;
    }
}
